package org.bbelovic.devel.exercises.sequences.impl;

import java.util.ArrayList;
import java.util.List;

import org.bbelovic.devel.exercises.sequences.SequenceGenerator;

public class PowersOfNSequenceGenerator implements SequenceGenerator {

    private final int power;

    public PowersOfNSequenceGenerator(final int power) {
        this.power = power;
    }

    public List<Integer> generateSequence(int n) {
        final List<Integer> result = new ArrayList<Integer>();
        int act = 1;
        for (int i = act; i <=n;i++)
        {
            result.add(act);
            act = act * power;
        }
        return result;
    }

}
